var t = getApp();

Page({
    data: {
        project_id: 0,
        point: {},
        isLoadMore: !1,
        total_page: 0,
        page: 1
    },
    onLoad: function(t) {
        this.setData({
            project_id: t.project_id,
            point: JSON.parse(t.point)
        }), this.getData();
    },
    onReady: function() {},
    toRouter: function(t) {
        var a = t.currentTarget.dataset.id;
        wx.navigateTo({
            url: "/packageC/o2o/HomeSeller/HomeSeller?store_id=" + a
        });
    },
    getData: function() {
        var a = this, o = t.getNetAddresss("plugin.appointment.frontend.project.getDetailStore");
        t._getNetWork({
            url: o,
            data: {
                lng: this.data.point.lng,
                lat: this.data.point.lat,
                project_id: this.data.project_id
            },
            success: function(t) {
                var o = t.data;
                1 == o.result ? (a.data.isLoadMore = !0, a.data.total_page = o.data.last_page, a.data.total_page || (a.data.total_page = 0), 
                a.setData({
                    store: o.data.data
                })) : wx.showToast({
                    title: o.msg,
                    icon: "none"
                });
            },
            fail: function(t) {
                console.log(t);
            }
        });
    },
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        this.data.isLoadMore ? this.getMoreData() : console.log("没有更多了");
    },
    onShareAppMessage: function() {},
    getMoreData: function() {
        var a = this, o = "";
        this.data.isLoadMore = !1, this.data.page >= this.data.total_page || (this.data.page = this.data.page + 1, 
        o = t.getNetAddresss("plugin.appointment.frontend.project.getDetailStore"), t._postNetWork({
            url: o,
            data: {
                page: this.data.page,
                lng: this.data.point.lng,
                lat: this.data.point.lat,
                project_id: this.data.project_id
            },
            success: function(t) {
                var o = t.data;
                1 == o.result ? (a.data.isLoadMore = !0, a.setData({
                    store: a.data.store.concat(o.data.data)
                })) : (a.data.page = a.data.page - 1, a.isLoadMore = !1, wx.showToast({
                    icon: "none",
                    title: o.msg,
                    duration: 1500
                }));
            },
            fail: function(t) {
                console.log(t);
            }
        }));
    }
});